package downloader

/**
 *Mimetype & Suffix change(Only image)
 */
var mimeTypes = map[string]string{
	".gif":  "image/gif",
	".jpg":  "image/jpeg",
	".png":  "image/png",
	".tif":  "image/tiff",
	".wbmp": "image/vnd.wap.wbmp",
	".ico":  "image/x-icon",
	".jng":  "image/x-jng",
	".bmp":  "image/x-ms-bmp",
	".svg":  "image/svg+xml ",
	".webp": "image/webp",
}
var fileSuffix = map[string]string{
	"image/gif":          ".gif",
	"image/jpeg":         ".jpg",
	"image/png":          ".png",
	"image/tiff":         ".tif",
	"image/vnd.wap.wbmp": ".wbmp",
	"image/x-icon":       ".ico",
	"image/x-jng":        ".jng",
	"image/x-ms-bmp":     ".bmp",
	"image/svg+xml ":     ".svg",
	"image/webp":         ".webp",
}

func MimeToSuffix(mime string) (string, bool) {
	suffix, ok := fileSuffix[mime]
	return suffix, ok
}
func SuffixToMime(suffix string) (string, bool) {
	mime, ok := mimeTypes[suffix]
	return mime, ok
}
